import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 38917
 * Date: 2025-02-14
 * Time: 18:00
 */
public class test {

    public static void demo(int[] array){
        int[] str = Arrays.copyOf(array,array.length);
        Sort sort = new Sort();
        sort.insertSort(str);
        System.out.println("插入排序" + Arrays.toString(str));
    }
    public static void demo2(int[] array){
        int[] str = Arrays.copyOf(array,array.length);
        Sort sort = new Sort();
        sort.shellSort(str);
        System.out.println("希尔排序" + Arrays.toString(str));
    }
    public static void demo3(int[] array){
        int[] str = Arrays.copyOf(array,array.length);
        Sort sort = new Sort();
        sort.selectSort(str);
        System.out.println("选择排序" + Arrays.toString(str));
    }
    public static void demo4(int[] array){
        int[] str = Arrays.copyOf(array,array.length);
        Sort sort = new Sort();
        sort.selectSort2(str);
        System.out.println("选择排序2" + Arrays.toString(str));
    }
    public static void demo5(int[] array){
        int[] str = Arrays.copyOf(array,array.length);
        Sort sort = new Sort();
        sort.heapSort(str);
        System.out.println("堆排序" + Arrays.toString(str));
    }
    public static void demo6(int[] array){
        int[] str = Arrays.copyOf(array,array.length);
        Sort sort = new Sort();
        sort.bubbleSort(str);
        System.out.println("冒泡排序" + Arrays.toString(str));
    }
    public static void demo7(int[] array){
        int[] str = Arrays.copyOf(array,array.length);
        Sort sort = new Sort();
        sort.quickSort(str);
        System.out.println("快速排序" + Arrays.toString(str));
    }
    public static void demo8(int[] array){
        int[] str = Arrays.copyOf(array,array.length);
        Sort sort = new Sort();
        sort.quickSortNor(str);
        System.out.println("非递归快速排序" + Arrays.toString(str));
    }
    public static void demo9(int[] array){
        int[] str = Arrays.copyOf(array,array.length);
        Sort sort = new Sort();
        sort.mergeSort(str);
        System.out.println("归并排序" + Arrays.toString(str));
    }
    public static void demo10(int[] array){
        int[] str = Arrays.copyOf(array,array.length);
        Sort sort = new Sort();
        sort.mergeSortNor(str);
        System.out.println("非递归归并排序" + Arrays.toString(str));
    }
    public static void demo11(int[] array){
        int[] str = Arrays.copyOf(array,array.length);
        Sort sort = new Sort();
        sort.countSort(str);
        System.out.println("计数排序" + Arrays.toString(str));
    }

    public static void main(String[] args) {
        int[] array = {1, 334, 71, 51, 5, 8, 61, 56, 12, 1, 12, 5, 8};
        demo(array);
        demo2(array);
        demo3(array);
        demo4(array);
        demo5(array);
        demo6(array);
        demo7(array);
        demo8(array);
        demo9(array);
        demo10(array);
        demo11(array);
    }
}
